package org.artifact.core.util;

import cn.hutool.core.lang.Console;

public class NumUtil {
    public static long setLongFlag(long src, int index) {
        return src | (1L << index);
    }

    public static long resetLongFlag(int src, int index) {
        return src & ~(1L << index);
    }

    public static boolean checkLongFlag(long src, int index) {
        return (src & (1L << index)) != 0;
    }

    public static int setIntFlag(int src, int index) {
        return src | (1 << index);
    }

    public static int resetIntFlag(int src, int index) {
        return src & ~(1 << index);
    }

    public static boolean checkIntFlag(int src, int index) {
        return (src & (1 << index)) != 0;
    }

    public static void main(String[] args) {
        int src = 0;
        src = setIntFlag(src,1);

        Console.log(checkIntFlag(src,1));

        Console.log(NumUtil.setIntFlag(0,1));
    }
}
